package com.central.rearService.controller

import com.central.common.annotation.LoginUser
import com.central.common.enum.AttentionTypeEnum
import com.central.common.model.CommonResult
import com.central.common.model.RealDataResult
import com.central.common.model.SysUser
import com.central.rearService.service.AttentionService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import springfox.documentation.annotations.ApiIgnore

/**
 * @author  fly
 * @date  2021/5/26 14:55
 * @version 1.0
 */
@Api(tags = ["(小程序) 关注模块"])
@RestController
@RequestMapping("attention")
open class AttentionController {

    @Autowired
    private lateinit var attentionService: AttentionService


    @ApiOperation("处理关注")
    @PostMapping("resolveAttention")
    fun resolveAttention(attentionId: Long, @ApiIgnore @LoginUser sysUser: SysUser, type: Int): CommonResult<Boolean> =
        attentionService.resolveAttention(attentionId, sysUser, type)


    @ApiOperation("(rpc) 获取我关注的列表")
    @GetMapping("getMyAttentionUserId")
    fun getMyAttentionIdList(userId: Long, attentionTypeEnum: AttentionTypeEnum): List<String>? =
        attentionService.getMyAttentionIdList(userId, attentionTypeEnum)


    @ApiOperation("(rpc) 是否关注")
    @PostMapping("/booleanAttention")
    fun booleanAttention(attentionId: Long, userId: Long, attentionTypeEnum: AttentionTypeEnum): RealDataResult? =
        attentionService.booleanAttention(attentionId, userId, attentionTypeEnum)


    @ApiOperation("(rpc) 获取我的粉丝用户列表")
    @GetMapping("getMyFansUserId/{userId}")
    fun getMyFansUserId(@PathVariable userId: Long): List<String>? = attentionService.getMyFansUserId(userId)
}